<template>
    <div class="heart">
      <el-breadcrumb separator="">
        <el-breadcrumb-item :to="{ path: '/dataReport' }">数据报表</el-breadcrumb-item>
        <el-breadcrumb-item
        ><a></a></el-breadcrumb-item
      >
      </el-breadcrumb>
      <div class="search">
        <el-input v-model="companyName" style="width:250px;"  placeholder="公司名称">
        </el-input>
          <el-select
            v-model="area"
            placeholder="行政区域"
            size="large"
            clearable
            style="width: 240px"
            :popper-append-to-body="false"
          >
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
          <el-select
            v-model="instury"
            placeholder="行业类型"
            size="large"
            clearable
            style="width: 240px"
            :popper-append-to-body="false"
          >
            <el-option
              v-for="item in options1"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        <el-button type="primary" style="width: 80px;">查询</el-button>
      </div>
      <el-card style="height: 70px; margin-top: 20px; position:relative;" shadow="hover">
        <el-button type="primary" style="width: 100px;">查看重度污染</el-button>
        <el-button type="primary" style="width: 100px;">查看费用计算</el-button>
        <el-button type="primary" style="width: 100px;">导出数据 </el-button>
      </el-card>
      <el-table
      ref="multipleTableRef"
      :data="tableData"
      style="width: 100%; margin-top: 20px"
      @sort-change="handleSort"
    >
        <el-table-column prop="a" label="企业名称" />
        <el-table-column prop="b" label="行政区域" />
        <el-table-column prop="c" label="所属行业" />
        <el-table-column prop="d" label="产污用电" />
        <el-table-column prop="e" label="治污用电" />
        <el-table-column prop="f" label="总用电" />
        <el-table-column prop="g" label="操作" >
            <template #default="scope">
                <el-button>查看状态详情</el-button>
              </template>
        </el-table-column>
    </el-table>
    <div class="pagination">
      <Pagination v-model:page="page"  :total="total" @pagination="getData" />
    </div>
    </div>
      
  </template>
  <script lang="ts" setup>
  import { ref, watch, onMounted, reactive,  } from 'vue'
  import Pagination from '../../components/Pagination.vue'
    let timeRange =  ref('')
    let area = ref()
    let instury = ref()
    const options = [
  {
    value: 1,
    label: '武昌区',
  },
  {
    value: 2,
    label: '汉口区',
  },
  {
    value: 3,
    label: '汉阳区',
  },
]
const options1 = [
  {
    value: 1,
    label: '医疗业',
  },
  {
    value: 2,
    label: '制造业',
  },
  {
    value: 3,
    label: '加工业',
  },
]
    onMounted(()=>{
      console.log(tableData.value)
    })
    const tableData = ref([
      {
        a:'米鹰讯1',
        b:'武昌区',
        c:'医疗',
        d:'440',
        e:'450',
        f:'1431',
        g:'50',
        h:'60',
        i:'1000',
        j:'1200'
      },
      {
        a:'米鹰讯2',
        b:'武昌区',
        c:'医疗',
        d:'440',
        e:'450',
        f:'1432',
        g:'20',
        h:'70',
        i:'1400',
        j:'1500'
      },
      {
        a:'米鹰讯3',
        b:'武昌区',
        c:'医疗',
        d:'430',
        e:'450',
        f:'1453',
        g:'54',
        h:'65',
        i:'1060',
        j:'1230'
      },
      {
        a:'米鹰讯4',
        b:'汉口区',
        c:'服装',
        d:'430',
        e:'410',
        f:'1542',
        g:'54',
        h:'65',
        i:'1010',
        j:'1210'
      },
      {
        a:'米鹰讯5',
        b:'汉口区',
        c:'医疗',
        d:'440',
        e:'450',
        f:'1432',
        g:'50',
        h:'60',
        i:'1000',
        j:'1200'
      },
      {
        a:'米鹰讯6',
        b:'汉阳区',
        c:'教育',
        d:'470',
        e:'452',
        f:'1431',
        g:'60',
        h:'40',
        i:'1004',
        j:'1300'
      },

      {
        a:'米鹰讯7',
        b:'洪山区',
        c:'医疗',
        d:'440',
        e:'450',
        f:'1542',
        g:'50',
        h:'60',
        i:'1000',
        j:'1200'
      },
      {
        a:'米鹰讯8',
        b:'洪山区',
        c:'医疗',
        d:'440',
        e:'450',
        f:'1531',
        g:'50',
        h:'60',
        i:'1000',
        j:'1200'
      },
      {
        a:'米鹰讯9',
        b:'青山区',
        c:'医疗',
        d:'454',
        e:'450',
        f:'1532',
        g:'35',
        h:'64',
        i:'1000',
        j:'1200'
      },
      {
        a:'米鹰讯10',
        b:'洪山区',
        c:'医疗',
        d:'421',
        e:'434',
        f:'1453',
        g:'45',
        h:'60',
        i:'1040',
        j:'1256'
      },
    ])
    interface Instrument {
      id: number,
      companyName: string,
      outputName: string,
      instrumentName: string,
      instrumentMIN: string,
      password: string,
      isUsing: boolean
    }
    let selected = ref<number[]>([])
    const handleSelectionChange = (a:Instrument[])=>{
      selected.value = [];
      a.forEach((row:Instrument)=>{
        selected.value.push(row.id)
      })
      console.log(selected.value)
    }
  
    let handleSort = (data: {column: any, prop: string, order: any })=>{
      console.log(data)
    }
    let currentPage = ref(1)
    let pageSize = ref(10)
    let total = ref(100)
    let page = ref(1)

  </script>
  <style>
    .heart{
      width: 95%;
      margin: 20px auto;
    }
    .search{
      margin-top: 50px;
      display: flex;
      justify-content: space-around;
    }
    .pagination{
      margin-top: 40px;
      display: flex;
      justify-content: center;
    }
  </style>